<template>
  <u-sticky>
    <view class="my-head">
      <image class="back-icon" src="https://www.rebirthealth.com/static/images/back.png" @click="goBack"
        v-if="showBack"></image>
      <view class="my-title">{{ title }}</view>
    </view>
  </u-sticky>
</template>

<script>
export default {
  props: {
    title: {
      default: "个人资料",
    },
    showBack: {
      default: false,
    },
    customFunc: {
      default: null
    }
  },
  methods: {
    // 返回上一级页面
    goBack() {
      if (this.customFunc) {
        this.$emit('handleBack')
      } else {
        uni.navigateBack({
          delta: 1,
        });
      }
    },
  },
};
</script>

<style scoped>
.my-head {
  height: 220rpx;
  padding-top: 108rpx;
  position: relative;
  box-sizing: border-box;
  background: #131e32;
}

.my-head .my-title {
  text-align: center;
  color: rgba(4, 95, 178, 1);
  font-size: 48rpx;
  letter-spacing: 4px;
  line-height: 52px;
  font-weight: bold;
}

.my-head .back-icon {
  width: 32rpx;
  height: 32rpx;
  position: absolute;
  left: 32rpx;
  top: 146rpx;
}
</style>
